Feature: Census page - Get Cut off date

  # Author: Maria Chen
  # Execution&Update History
  # |Date          |Owner        |Update/Execution Remark        |Comments                          |
  # |4/8/2016    |Maria Chen   |First Draft                    |
  Background: 
    Given these Alliances:
      | alliance |
      | Gro21010 |
      | Cel26959 |
      | Pac26719 |
      | Pre25314 |
      | Lif25312 |

  ####################################Get product line cut off date################################
  @happy
  Scenario: Valid alliance id and product line - Get carrier cut off date
    When I send a GET request to "census/census-condition/cutoffdate/ifp/Gro21010"
    Then the response status should be 200
    And the JSON response should be
      """
      {
      "allianceId":"Gro21010",
      "productLine":"IFP",
      "cutOffDate":[
      "${json-unit.ignore}",
      "${json-unit.ignore}",
      "${json-unit.ignore}"
      ]
      }
      """

  @happy
  Scenario: Valid alliance id and product line - Get Medicare carrier cut off date
    When I send a GET request to "census/census-condition/cutoffdate/ma/Gro21010"
    Then the response status should be 200
    And the JSON response should be
      """
      {
      "allianceId": "Gro21010",
      "productLine": "MA",
      "cutOffDate": [
      "${json-unit.ignore}"
      ]
      }
      """

  @happy
  Scenario: Valid alliance id and product line - Get Dental carrier cut off date
    When I send a GET request to "census/census-condition/cutoffdate/dt/Pac26719"
    Then the response status should be 200
    And the JSON response should be
      """
      {
      "allianceId": "Pac26719",
      "productLine": "DT",
      "cutOffDate": [
      "${json-unit.ignore}"
      ]
      }
      """

  ####################################Test Case that will fail################################
  @sad
  Scenario: Valid alliance id and product line - Carrier doesn't configure the cut off date
    When I send a GET request to "census/census-condition/cutoffdate/hsa/Gro21010"
    Then the response status should be 400
    And the error message should be "Can't find mcei.Alliance.HSA.requestedEffectiveDate.MaxDays in xpathmap.xml"

  @sad
  Scenario: Product line not supported for the carrier - System should return error message
    When I send a GET request to "census/census-condition/cutoffdate/st/Lif25313"
    Then the response status should be 400
    And the error message should be "AllianceId : Lif25313 doesn't support product line ST"

  @sad
  Scenario: Product line invalid - System should return error message
    When I send a GET request to "census/census-condition/cutoffdate/stt/Gro21010"
    Then the response status should be 400
    And the error message should be "Invalid product line : STT"

  @sad
  Scenario: Alliance Id not belong to istore - System should return error message
    When I send a GET request to "census/census-condition/cutoffdate/ifp/jet90000"
    Then the response status should be 400
    And the error message should be "iStore not support the allianceId: jet90000"

  @sad
  Scenario: Alliance Id Invalid - System should return error message
    When I send a GET request to "census/census-condition/cutoffdate/ifp/jet00000"
    Then the response status should be 400
    And the error message should be "Invalid AllianceId : jet00000"

  @sad
  Scenario: URL Invalid - System should return error message
    When I send a GET request to "census/census-condition/cutoffdate/ifp/Gro21010/fff"
    Then the response status should be 404
    And the error message should be "Resource doesn't exist"
